package com.itheima.controller;

import com.itheima.domain.SmsCode;
import com.itheima.service.SmsCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName: SmsCodeController
 * Description:
 * Date: 2023/03/11 AM 12:33:14
 * <p>
 * project: springboot
 * package: com.itheima.controller
 * email: 1085844536@qq.com
 * version:
 *
 * @author WangGuojian
 */
@RestController
@RequestMapping("/sms")
public class SmsCodeController {

    @Autowired
    private SmsCodeService smsCodeService;

    @GetMapping
    public String getCode(String tele) {
        return smsCodeService.sendCodeToSms(tele);
    }

    @PostMapping
    public boolean checkCode(SmsCode smsCode) {
        return smsCodeService.checkCode(smsCode);
    }
}
